home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-11-26 | 2.8 KB | 68 lines | [TEXT/ALFA] |
- ## -*-Tcl-*-
- # ###################################################################
- # Vince's Additions - an extension package for Alpha
- #
- # FILE: "CCompletions.tcl"
- # created: 31/7/97 {2:46:39 pm}
- # last update: 26/11/97 {2:25:35 pm}
- # Author: Vince Darley
- # E-mail: <darley@fas.harvard.edu>
- # mail: Division of Engineering and Applied Sciences, Harvard University
- # Oxford Street, Cambridge MA 02138, USA
- # www: <http://www.fas.harvard.edu/~darley/>
- #
- # Copyright (c) 1997 Vince Darley
- #
- # ###################################################################
- ##
-
- set completions(C) {completion::cmd Electric Class completion::word}
- set completions(C++) {completion::cmd Electric Class completion::word}
-
- lunion "CTemplates" createNewClass newFunction
-
- # ◊◊◊◊ Completions ◊◊◊◊ #
-
- set Ccmds { #elseif #endif #include class default enum for register return
- struct switch typedef volatile while }
-
- set Celectrics(for) " (•init•;•test•;•increment•)\{\n\t•loop body•\n\}\n••"
- set Celectrics(while) " (•test•)\{\n\t•loop body•\n\}\n••"
- set Celectrics(switch) " (•value•)\{\n…case •item•:\n\t•case body•\n…default:\n\t•default body•\n\}\n••"
- set Celectrics(case) " •item•:\n…•case body•\ncase"
- set Celectrics(do) " \{••\n\t••\n\} while (•test•);\n••"
- set Celectrics(if) "(•condition•)\{\n\t•if body•\n\} ••"
- set Celectrics(else) " \{\n\t•else body•\n\} ••"
- set Celectrics(class) " •object name• : public •parent• \{\n…public:\n\t•object name•(•args•);\n\t~•object name•(void);\n\n\};\n••"
- set Celectrics(struct) " •object name• \{\n\t•object name•(•args•);\n\t~•object name•(void);\n\n\};\n••"
- set Celectrics(enum) " •name• \{ •item•, •item ... item• \};\n••"
- # For these two to work you must use my '#' modified definitions of
- # wordBreak, wordBreakPreface (defined by Vince's Additions).
- set Celectrics(#if) " ••\n\t••\n#endif\n••"
- set Celectrics(#include) " \"•file•.h\"\n••"
- set Celectrics(try) " \{\r\t•try body•\r\}\rcatch (•...•) \{\r\t•catch body•\r\}\r••"
- ##
- # -------------------------------------------------------------------------
- #
- # "C::Completion::Class" --
- #
- # If we've just typed the name of a class, struct or union, we can
- # automatically fill in all occurrences of that name in the rest of
- # the class. (e.g. in constructors, destructors etc.)
- # -------------------------------------------------------------------------
- ##
- proc C::Completion::Class { {cmd ""}} {
- set cl [completion::lastTwoWords prev]
- if {[lsearch "class struct union" [string trim $prev]] == -1} {
- return 0
- }
- if [ring::type] {ring::replaceStopMatches "object name" $cl}
- return 1
- }
-
- proc C::Completion::Electric { {cmd ""} } {
- if { [completion::lastWord] == "case " } { backwardChar }
- return [completion::electric $cmd]
- }
-
-